﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace RedMoon.WebApp.Main
{
    public partial class GetServerInfo : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            responseHtml();
        }
        private void responseHtml()
        {
            string path = Server.MapPath(".");
            Response.Write("Session超时时间：" + Session.Timeout + " 完整路径：" + path);
            System.Text.StringBuilder sb = new System.Text.StringBuilder();
            sb.Append(string.Format("<br/>当前时间: {0}", Server.HtmlEncode(DateTime.Now.ToString())));
            sb.Append("<br />");
            sb.Append(string.Format("当前请求的虚拟路径: {0}", Server.HtmlEncode(Request.CurrentExecutionFilePath)));
            sb.Append("<br />");
            sb.Append(string.Format("获取当前应用程序的根目录路径: {0}", Server.HtmlEncode(Request.ApplicationPath)));
            sb.Append("<br />");
            sb.Append(string.Format("当前请求的虚拟路径: {0}", Server.HtmlEncode(Request.FilePath)));
            sb.Append("<br />");
            sb.Append(string.Format("当前请求的虚拟路径: {0}", Server.HtmlEncode(Request.Path)));
            sb.Append("<br />");
            sb.Append(string.Format("获取当前正在执行的应用程序的根目录的物理文件系统路径: {0}", Server.HtmlEncode(Request.PhysicalApplicationPath)));
            sb.Append("<br />");
            sb.Append(string.Format("获取与请求的 URL 相对应的物理文件系统路径: {0}", Server.HtmlEncode(Request.PhysicalApplicationPath)));
            sb.Append("<br />");
            Response.Write(sb.ToString());
            Response.End();
        }
    }
}